﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharpLab
{
    class Debug
    {
        /// <summary>
        /// Liste der Meldungen
        /// </summary>
        private List<DebugTypes.logMessage> _logList = new List<DebugTypes.logMessage>();
        /// <summary>
        /// Debugfenster
        /// </summary>
        private DebugForm dbgFrm;
  
        public Debug()
        {

        }

        public void addMessage(DebugTypes.TMess MsgType, string Class, string Function, string Message)
        {
            DebugTypes.logMessage lmess = new DebugTypes.logMessage();

            lmess.TimeStamp = DateTime.Now;
            lmess.LogType = MsgType;
            lmess.Class = Class;
            lmess.Function = Function;
            lmess.Message = Message;

            _logList.Add(lmess);
        }

        public void openDbgWindow()
        {
            if (dbgFrm == null || dbgFrm.IsDisposed)
                dbgFrm = new DebugForm(_logList);
            
            dbgFrm.Show();
        }
    }
}
